package marker.micro.gateway.filter;

import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;

import com.netflix.zuul.context.RequestContext;

public class GetRequestAccessTokenFilter extends AbstractZuulFilter {

    @Override
    public Object run() {
	RequestContext context = RequestContext.getCurrentContext();
	String url = (String) context.get(FilterConstants.REQUEST_URI_KEY);
	logger.info("ori url:" + url + ",serviceId:" + context.get("serviceId"));
	return null;
    }

    @Override
    public boolean shouldFilter() {
	return StringUtils.equalsIgnoreCase(RequestContext.getCurrentContext().getRequest().getMethod(), "get");
    }

    @Override
    public int filterOrder() {
	return FilterConstants.PRE_DECORATION_FILTER_ORDER - 1;
    }

    @Override
    public String filterType() {
	return FilterConstants.ROUTE_TYPE;
    }

}
